<%@ Page Language="VB" Inherits="CMS"  MasterPageFile="~/userfiles/mastercms.master"  %>
<%@ import Namespace="System.Data.OLEDB" %>
<%@ import Namespace="System.Data" %>
<%@ Import Namespace="System.Web" %>

<script runat="server">
    'Version: 07.06.2007 Masterdatei angepasst
    Dim mydescription As String
    Dim Zeilenanzahl as integer = 0
    Dim metaTag As New HtmlMeta
    
    Dim metaTag1 As New HtmlMeta
     
    Sub Page_Load(sender As Object, e As EventArgs)

        If Not IsPostBack Then
 
            BindGrid()
            
        End If
        'Page.Title = "mytitel"
    End Sub
    
    Sub BindGrid()
        Dim queryvalue As String = Request.QueryString("cms")
        If queryvalue <> "" Then
            MyDataGrid.DataSource = tbPages.GetDataSet(strWhere:="pageart = '" & queryvalue & "'", strOrder:="creationdate DESC").Tables(0).DefaultView
        else
            MyDataGrid.DataSource = tbPages.GetDataSet(strWhere:="pageart = 'N'", strOrder:="creationdate DESC").Tables(0).DefaultView
        end if
        MyDataGrid.DataBind()
    End Sub
    
    Sub MyDataGrid_Page(ByVal sender As Object, ByVal e As DataGridPageChangedEventArgs)
        MyDataGrid.CurrentPageIndex = e.NewPageIndex
        BindGrid()
    End Sub
   
Function GetURL (ByVal fldval As String,ByVal fldval2 As String,ByVal mydescription As String,ByVal mytitel As String) As String
    
    Zeilenanzahl = Zeilenanzahl + 1
    mydescription = mydescription & fldval
    Page.Title = Page.Title & fldval & ", "
    if Zeilenanzahl = 1 then
        metaTag.HttpEquiv = "Description"
        metaTag1.HttpEquiv = "Keywords"
    end if
    if Zeilenanzahl < 4 then
        metaTag.Content = metaTag.Content & mydescription & ", "
        Header.Controls.Add(metaTag)
        metaTag1.Content = metaTag1.Content & mytitel & ", "
        Header.Controls.Add(metaTag1)   
    end if
    
	Return fldval & "-" & fldval2 & ".aspx"
 
End Function

</script>



<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">

<asp:DataGrid id="MyDataGrid" runat="server"
        AllowPaging="True"
        PagerStyle-Mode="NumericPages"
        PagerStyle-HorizontalAlign="Right"
        PagerStyle-NextPageText="Next"
        PagerStyle-PrevPageText="Prev"
        OnPageIndexChanged="MyDataGrid_Page"
        PagerStyle-Width="100%"
        CellPadding="4"
        AutoGenerateColumns="False" GridLines="None" Width="100%" PageSize="5" CssClass="table"
        >

        <Columns>
        <asp:BoundColumn HeaderText="CNR" Visible="False" ReadOnly="True" SortExpression="CNR" DataField="CNR"/>
            <asp:TemplateColumn 
                HeaderText="Details">
                <ItemTemplate>
		            <asp:HyperLink ID="HyperLink1" runat="server"
		            NavigateUrl ='<%#GetURL(DataBinder.Eval(Container.DataItem, "Linktext"),DataBinder.Eval(Container.DataItem, "cnr"),DataBinder.Eval(Container.DataItem, "metadescription"),DataBinder.Eval(Container.DataItem, "metakeywords"))%>' >
		            <%#DataBinder.Eval(Container.DataItem, "LinkText")%>
		            </asp:HyperLink>
		            </ItemTemplate>
                <ItemStyle VerticalAlign="Top" />
                </asp:TemplateColumn>
            <asp:BoundColumn HeaderText="Inhalt" SortExpression="metadescription" DataField="metadescription">
                <HeaderStyle Width="70%" HorizontalAlign="Center" />
            </asp:BoundColumn>
            <asp:BoundColumn HeaderText="Datum" DataFormatString="{0:dd.MM.yyyy}" SortExpression="creationdate" DataField="creationdate" >
                <ItemStyle VerticalAlign="Top" />
            </asp:BoundColumn>
        </Columns>
  
    </asp:DataGrid>
<asp:Label ID="lblSortierung" Font-Size="XX-Small" runat="server" Text=""></asp:Label><br />
    </asp:Content>
